package com.usian.user.controller.v1;

import com.usian.apis.user.AuthUserControllerApi;
import com.usian.common.constant.user.UserConstants;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.user.dtos.AuthDto;
import com.usian.user.service.AuthUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: ApUserRealnameController
 * Author:   WGG
 * Date:    2022-11-2022/11/14-10:30
 * Version: 1.0
 * Description:
 */

@RestController
@RequestMapping("/auth/api/v1")
public class AuthUserController implements AuthUserControllerApi {

    @Autowired
    private AuthUserService authUserService;
    /**
     * APP实名认证信息查询
     * @param dto
     * @return
     */
    @Override
    @PostMapping("/list")
    public ResponseResult loadListByStatus(@RequestBody AuthDto dto) {
        return authUserService.list(dto);
    }

    /**
     * 通过
     * @param dto
     * @return
     */
    @Override
    @PostMapping("/authPass")
    public ResponseResult authPass(@RequestBody AuthDto dto) {
        return authUserService.updateStatusById(dto, UserConstants.PASS_AUTH);
    }

    /**
     * 驳回
     * @param dto
     * @return
     */
    @Override
    @PostMapping("/authFail")
    public ResponseResult authFail(@RequestBody AuthDto dto) {
        return authUserService.updateStatusById(dto,UserConstants.FAIL_AUTH);
    }


}
